<?php
/**
 *
 * Model.php
 * User: kalvin
 * Date: 2018/1/25
 * Time: 上午10:05
 */

namespace core\lib;


use core\lib\conf\conf;
use Medoo\Medoo;

class Model extends Medoo
{
    protected static $table;

    public function __construct($config = null)
    {

        $config = conf::all('databases');
        $holeclassname = get_called_class();
        $allname = explode('\\', $holeclassname);
        self::$table = strtolower($allname[count($allname) - 1]);
        parent::__construct($config);
        return $this;
    }

    public  function all(){
        return $this->select(self::$table,'*');
    }
    public function getOne(){
        return $this->get(self::$table,'*');
    }

}